<?php
	$timezone = "Asia/Bangkok";
	if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
	
	$http = @$_SERVER["HTTPS"] == "on"? "https://": "http://";
	$cur_loc = $http . $_SERVER['HTTP_HOST'] . rtrim($_SERVER['SCRIPT_NAME'],basename($_SERVER['PHP_SELF']));
	//echo $cur_loc . '<br>' . strrpos($cur_loc,'/') . dirname($_SERVER['PHP_SELF']) . '<br>';
	$parent = substr($cur_loc,0,strrpos(rtrim($cur_loc,'/'),'/'));
	$root = str_replace('\\', '/' ,dirname(__FILE__));
	$http = str_replace("//","/",$http);
	//die($parent . "::" .  $http);
	if($parent == $http){
		$parent = $cur_loc;
		$config = 'config/';
	}
	else{
		$parent .= '/';
		$config = '../config/';
	}
	
	define ( 'DEBUG', 1);
	define ( 'DS', '/' );
	define ( 'DOT', '.' );
	define ( 'DELIMITER', '_' );
	define ( 'BASE_URL',  $cur_loc);		
	define ( 'CONFIG', $config );		
	define ( 'PARENT_URL', $parent);
	define ( 'ROOT', $root . DS );
	define ( 'WEB_ROOT', 'webroot' . DS );
	define ( 'WWW_ROOT',  ROOT . WEB_ROOT);
	define ( 'CSS', BASE_URL . 'css' . DS );
	define ( 'CSSC', BASE_URL . 'cssc' . DS );
	define ( 'JS', BASE_URL . 'js' . DS );
	define ( 'JSC', BASE_URL . 'jsc' . DS );
	define ( 'IMG', BASE_URL . 'img' . DS );
	define ( 'IMGC', BASE_URL . 'imgc' . DS );
	define ( 'FILE', BASE_URL . 'files' . DS );
	define ( 'DOWNLOAD', FILE . 'downloads' . DS );
	define ( 'VIEW', 'view' . DS );
	define ( 'CONTROLLER' , 'controller' . DS );
	define ( 'MODEL', 'model' . DS );
	define ( 'HELPER', VIEW . 'helper' . DS );
	define ( 'VENDOR', 'vendor' . DS);
	define ( 'ELEMENT' , VIEW . 'elements' . DS );
	define ( 'LAYOUT', VIEW . 'layouts' . DS );
	define ( 'COPY_RIGHTS', 'Copyright &copy; ' . Date('Y') . ' Ice Factory. All rights reserved.' );// Information provided is subject to change without prior notice.	
?>